
// _POSTER_单例对象实例
let _POSTER_ = null;
let _CONFIG = {};

function POSTER(config) {

    // 保持单例模式
    if (_POSTER_) {
        return _POSTER_;
    }
    _CONFIG = config;
    return _POSTER_ = this;
}

POSTER.prototype = {

    sendDataByImg(uploadData) {

        if (!_CONFIG.api) return false;

        try {
            const formData = [];
            for (const key in uploadData) {
                formData.push(key + '=' + uploadData[key]);
            }
            const dataStr = formData.join('&');
            const image = new Image();
		    image.src = _CONFIG.api + (_CONFIG.api.indexOf('?') > -1? "&":"?") + dataStr;
            // image.style.display = 'none';   
        } catch (error) {
            
        }        
    },

};

export default POSTER;